package LeetCode._顺序刷题;

import java.util.List;
import java.util.Stack;

/**
 * @Author: yqy
 * @Date: 2022/06/06/20:04
 * @Description:
 */
public class _160 {
    public static void main(String[] args) {

    }
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode pA=headA;
        ListNode pB=headB;
        while(pA.val!= pB.val){
            pA = pA == null ? headB : pA.next;
            pB = pB == null ? headA : pB.next;

        }
        return pA;
    }
}
